#pragma once

#include "Headers.h"

class Character
{
private:
	XY Pos;
	XY MovingTo;
	bool Moving;
	int TextureIndex;
public:
	Character():Pos(0,0),TextureIndex(0){}
	Character * Create()
	{
		Character * C = new Character;
		C->Init();
		return C;
	}
	void Init()
	{
		Pos.x = 0;Pos.y = 0;
		MovingTo.x = 0;MovingTo.y = 0;
		TextureIndex = -1;
		Moving = false;
	}
	void MoveTo(COORD C)
	{
		MovingTo = C;
		Moving = true;
	}
	void Update(double dT)
	{
		Move(dT);
	}
	void Move(double dT)
	{
		if(Moving)
		{
			if(Pos.x < MovingTo.x)
				Pos.x += (int)dT/2;
			if(Pos.x > MovingTo.x)
				Pos.x -= (int)dT/2;
			if(Pos.y < MovingTo.y)
				Pos.y += (int)dT/2;
			if(Pos.y > MovingTo.y)
				Pos.y -= (int)dT/2;
		}
	}
};